package 笔试;

public class 替换字符串中的数字 {
    public String replaceStr (String s) {
        // write code here
        StringBuilder sb = new StringBuilder();
        String ss = "num";
        for(int i = 0; i < s.length(); i++) {
            if(s.charAt(i) >= '0' && s.charAt(i) <= '9') {
                while(i < s.length() && s.charAt(i) >= '0' && s.charAt(i) <= '9') {
                    i++;
                }
                i--;
                sb.append(ss);
            } else {
                sb.append(s.charAt(i));
            }
        }
        return sb.toString();
    }
}
